package com.salim.summary.design.$2abstractFactory;

public class CarFactory extends AbstractVehicleFactory{
    @Override
    public Car getCar(String type){
        if(type.equals("big")){
            return new BigCar();
        }else if(type.equals("small")){
            return new SmallCar();
        }else if(type.equals("elec")){
            return new ElectricCar();
        }
        return null;
    }

    @Override
    public Plane getPlane(String type) {
        return null;
    }

    public static void main(String[] args){
        CarFactory carFactory = new CarFactory();
        carFactory.getCar("big").drive();
        carFactory.getCar("small").drive();
        carFactory.getCar("elec").drive();
    }
}

class BigCar implements Car {
    @Override
    public void drive() {
        System.out.println("big");
    }
}

class SmallCar implements Car {
    @Override
    public void drive() {
        System.out.println("small");
    }
}

class ElectricCar implements Car {
    @Override
    public void drive() {
        System.out.println("elec");
    }
}


